package com.wj.blog.service.impl;

import com.wj.blog.mapper.LogMapper;
import com.wj.blog.pojo.Log;
import com.wj.blog.service.LogService;
import com.wj.blog.utils.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Author:   wj
 * Date:     2020/4/9 15:20
 * Description:
 */
@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;

    @Override
    public void save(Log logger) {
        logMapper.save(logger);
    }

    /**
     * 分页查询
     *
     * @param page
     * @return
     */
    @Override
    public Page<Log> getByPage(Page<Log> page) {
        Page<Log> listPage = new Page<>();
        List<Log> logList = logMapper.getByPage(page);
        listPage.setTotalCount(logMapper.getCount(page));
        listPage.setList(logList);
        return listPage;
    }

    /**
     * 批量删除
     *
     * @param ids
     */
    @Override
    public void delete(List<Integer> ids) {
         logMapper.delete(ids);
    }
}
